package top.canyue.eca_manager.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;

/**
 * 操作日志
 *
 * @author Canyue 2024-05-10
 */
@Data
@AllArgsConstructor
public class OperationLog {
    @Id
    private String id;
    private String userId;
    private String level;
    private String operation;
    private String params;
    private Integer resultStatic;
    private Long createTime;

    //在写入日志时，ID与创建时间，应由数据库自动生成
    public OperationLog(String userId, String level, String operation, String params, Integer resultStatic) {
        this.userId = userId;
        this.level = level;
        this.operation = operation;
        this.params = params;
        this.resultStatic = resultStatic;
    }

    @Override
    public String toString() {
        return "OperationLog{" +
                "id:'" + id + '\'' +
                ", userId:'" + userId + '\'' +
                ", level:'" + level + '\'' +
                ", operation:'" + operation + '\'' +
                ", params:'" + params + '\'' +
                ", resultStatic:" + resultStatic +
                ", createTime:" + createTime +
                '}';
    }
}
